//
//  DelegateView.m
//  iOSCodeLearning
//
//  Created by TFAppleWork-Summer on 2018/4/9.
//  Copyright © 2018年 Ace. All rights reserved.
//

#import "DelegateView.h"

@implementation DelegateView

-(instancetype)init{
    if (self = [super init]) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.frame = CGRectMake(0, 0, 50, 50);
        button.backgroundColor = [UIColor greenColor];
        [button addTarget:self action:@selector(buttonClick) forControlEvents:UIControlEventTouchUpInside];
        
        [self addSubview:button];
    }
    return self;

}

-(void)buttonClick{
    if ([self.delegate respondsToSelector:@selector(viewClick)]) {
        [self.delegate viewClick];
    }
}

@end
